from sqlalchemy import Column, ForeignKey, DateTime
from sqlalchemy.dialects.oracle import VARCHAR2, NUMBER
from sqlalchemy.orm import relationship
from app.db.base import Base
from datetime import datetime, timezone




class UserPermission(Base):
    __tablename__ = "USER_PERMISSIONS"
    __table_args__ = {'schema': 'COOP_APP'}

    user_id = Column(VARCHAR2(36), ForeignKey("COOP_APP.USERS.user_id"), primary_key=True)
    permission_id = Column(NUMBER, ForeignKey("COOP_APP.PERMISSIONS.permission_id"), primary_key=True)

    user = relationship("User", back_populates="permissions")
    permission = relationship("Permission", back_populates="users")
